%.bin: %.asm
	nasm -f bin $< -o $@

tobyos.img: boot.bin loader.bin
	yes | bximage -q -hd=16 -func=create -sectsize=512 -imgmode=flat tobyos.img
	dd if=boot.bin of=tobyos.img bs=512 count=1 conv=notrunc
	dd if=loader.bin of=tobyos.img bs=512 count=4 seek=2 conv=notrunc

.PHONY: clean
clean:
	rm *.bin *.img

.PHONY: bochs
bochs: tobyos.img
	bochs -q